<%@ page language="java" contentType="text/html; charset=utf-8 " pageEncoding="utf-8" import="domain.Community,dao.community.*,java.util.List,domain.Room" %>
<html>
	<head>
		<meta charset="utf-8">
		<base href="<%=request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+request.getContextPath()+"/" %>"/>
		<meta name="viewport" content="width=drvice-width,height=device-height,inital-scale=1.0,maximum-scale=1.0,user-scalable=no;">
		<title>修改信息</title>
    </head>
    <script type="text/javascript">

                    	function beforeSubmit(){
                        if(document.getElementById('phone').value==''){
                        alert('手机不能为空！');
                        document.getElementById('phone').focus();
                        return false;
                        }
                        if(document.getElementById('onwername').value==''){
                        alert('业主姓名不能为空！');
                        document.getElementById('onwername').focus();
                        return false;
                        }
                        if(updateform.file.value == ""){
                        alert('房产证照片未上传');
                        document.getElementById('housePhoto').focus();
                        return false;
                        }
                        }
    </script>
	<style type="text/css">
		body{padding:0px;margin:0px;}
		.bgdiv{
			background:url(image/background.png) no-repeat;
			position: fixed;
			width: 100%;
			height: 100%;
			background-size:100% 100%;
		}
		.registeredbox{
			margin: auto;
			width: 80%;
			height: 450px;
			border-radius: 10px;
			box-shadow: rgba(0, 0, 0, 0.08) 1px 2px 4px 0px;
			background-color: white;
			opacity: 0.6;
			text-align: center;
		}
		.title{
			padding-top: 20px;
			font-weight: 600;
		}
		button{
			border-width: 0px;
			    width: 70px;
			    height: 25px;
			    background: inherit;
			    background-color: rgba(0, 207, 226, 1);
			    border: none;
			    border-radius: 50px;
			    -moz-box-shadow: none;
			    -webkit-box-shadow: none;
			    box-shadow: none;
			    font-size: 14px;
			    color: #FFFFFF;
				margin-top: 5px;
		}
		input{
						width: 100%;
						height: 6px;
		                border: 1px solid #ccc;
		                padding: 7px 0px;
		                border-radius: 3px;
		                padding-left:5px;
		                -webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075);
		                box-shadow: inset 0 1px 1px rgba(0,0,0,.075);
		                -webkit-transition: border-color ease-in-out .15s,-webkit-box-shadow ease-in-out .15s;
		                -o-transition: border-color ease-in-out .15s,box-shadow ease-in-out .15s;
		                transition: border-color ease-in-out .15s,box-shadow ease-in-out .15s
		            }
		            input:focus{
		                    border-color: #66afe9;
		                    outline: 0;
		                    -webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6);
		                    box-shadow: inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6)
		            }
					.loginform{
						margin: auto;
						width: 80%;
						padding-top: 20px;
						text-align: left;
						font-size: 12px;
						font-weight: 700;
					}
	</style>
		<%
                            	Room room=new Room();
                            	if(session.getAttribute("userloginflag")==null){
                            	%>
                            	<script type="text/javascript">
                            	    window.location.href="index.jsp";
                            	</script>
                                <% }else{
                                room=(Room)session.getAttribute("userloginflag");
                                %>
	<body>
		<div class="bgdiv"></div>
			<div class="registeredbox">
				<div class="title">修改信息</div>
				<div class="loginform">
				<form action="UserUpdate" method="post"  enctype="multipart/form-data"  onsubmit="return beforeSubmit(this)" name="updateform">

					手机<font style="color: red;">*</font>
					<input type="text" name="phone" id="phone" value="<%=room.getPhone() %>"  /><br />
					<span style="font-size: 8px;font-weight: 200;color: #555555;">您的有效联系方式</span><br /><br />

					业主姓名<font style="color: red;">*</font>
					<input type="text" name="ownername" id="ownername" value="<%=room.getOwnername() %>"  /><br />
					<span style="font-size: 8px;font-weight: 200;color: #555555;">应与房产证业主名字一致，否则将审核不通过</span><br /><br />

					房产证照片<font style="color: red;">*</font>
					<input type="file" id="housePhoto" name="housePhoto" onchange='PreviewImage(this)' style="height:30px ;"  /><br />
					<span style="font-size: 8px;font-weight: 200;color: #555555;">更新数据必须重新上传房产照片</span><br /><br />
					<div id="imgPreview" style="position: relative;left: 8%;margin-top: 10px;"><img src="<%=room.getHousecard_img() %>" width="60px"  /></div>
					<br /><center><button type="submit" id="submit">修改</button></center>
				</form>
				</div>
			</div>

	</body><% } %>
	<script>
	    if(/Android (\d+\.\d+)/.test(navigator.userAgent)){
	       var version = parseFloat(RegExp.$1);
	    if(version>2.3){
	       var phoneScale = parseInt(window.screen.width)/230;
	       document.write('<meta name="viewport" content="width=230, minimum-scale = '+ phoneScale +', maximum-scale = '+ phoneScale +', user-scalable=no, target-densitydpi=device-dpi">');
	       }else{
	            document.write('<meta name="viewport" content="width=230, target-densitydpi=device-dpi">');
	       }
	       }else{
	            document.write('<meta name="viewport" content="width=230, user-scalable=no, target-densitydpi=device-dpi">');
	       }
		   function PreviewImage(imgFile)
			{
				var pattern = /(\.*.jpg$)|(\.*.png$)|(\.*.jpeg$)|(\.*.gif$)|(\.*.bmp$)/;
				if(!pattern.test(imgFile.value))
				{
					alert("系统仅支持jpg/jpeg/png/gif/bmp格式的照片！");
					imgFile.focus();
				}
				else
				{
					var path;
					if(document.all)//IE
					{
						imgFile.select();
						path = document.selection.createRange().text;
						document.getElementById("imgPreview").innerHTML="";
						document.getElementById("imgPreview").style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled='true',sizingMethod='scale',src=\"" + path + "\")";//使用滤镜效果
					}
					else//FF
					{
						path = URL.createObjectURL(imgFile.files[0]);
						document.getElementById("imgPreview").innerHTML = "<img src='"+path+"' width='60px'/>";
					}
				}
			}

	</script>
</html>